home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 3 / CD ACTUAL 3.iso / linux / incoming / jstools-.6v3 / jstools- / jstools-tk3.6v3.0 / lib / jabout.tcl next >
Encoding:
Text File  |  1995-02-05  |  4.2 KB  |  139 lines

  1. # jabout.tcl - procedures for dealing with rich text
  2. # Copyright 1992-1994 by Jay Sekora.  All rights reserved, except 
  3. # that this file may be freely redistributed in whole or in part 
  4. # for non-profit, noncommercial use.
  5.  
  6. # j:about name richtext - create an about box containing richtext
  7. # j:about:button aboutbox label richtext - add a button to an about box
  8. # j:about_jay - return richtext describing me
  9. # j:about_tktcl - return richtext describing Tk and Tcl
  10.  
  11. # CHANGES:
  12. #   email address and url
  13.  
  14. ######################################################################
  15. # j:about name richtext - create an about box containing richtext
  16. ######################################################################
  17.  
  18. proc j:about { name args } {
  19.   j:parse_args {
  20.     {title "About"}
  21.   }
  22.   set w $name            ;# name of toplevel
  23.   set richtext [lindex $args 0]
  24.   
  25.   set old_focus [j:current_focus]    ;# so we can restore original focus
  26.   
  27.   if [winfo exists $w] {destroy $w}
  28.   toplevel $w
  29.   wm title $w $title
  30.   
  31.   text $w.t -width 65 -height 15 -borderwidth 20 -relief flat
  32.   j:rt text $w.t
  33.   eval $richtext
  34.   j:rt:done
  35.   
  36.   frame $w.b
  37.   button $w.b.ok -text OK -width 8 -command "
  38.     focus $old_focus
  39.     destroy $w
  40.   "
  41.   frame $w.b.ok-border -relief sunken -borderwidth 1
  42.   raise $w.b.ok
  43.   pack $w.b.ok -in $w.b.ok-border -padx 2 -pady 2
  44.  
  45.   pack [j:filler $w.b] -in $w.b -side left
  46.   pack [j:filler $w.b] -in $w.b -side right
  47.     
  48.   pack $w.b.ok-border -side right -pady 10
  49.   pack $w.t -in $w -side top -fill both
  50.   pack [j:rule $w -width 200] -in $w -side top -fill x
  51.   pack $w.b -in $w -side top -fill x
  52.   
  53.   j:dialogue $w            ;# position in centre of screen
  54.  
  55.   focus $w
  56.   bind $w <Key-Return> "$w.b.ok invoke"
  57. }
  58.  
  59. ######################################################################
  60. # j:about:button aboutbox label richtext - add a button to an about box
  61. ######################################################################
  62.  
  63. proc j:about:button { aboutbox label richtext } {
  64.   global j:about:button:count
  65.     if {[info exists j:about:button:count]} then {
  66.     set j:about:button:count [expr {${j:about:button:count} + 1}]
  67.   } else {
  68.     set j:about:button:count 0
  69.   }
  70.  
  71.   set parent $aboutbox.b    ;# name of frame with buttons
  72.   set button $parent.${j:about:button:count}
  73.   set border $button-border
  74.  
  75.   set min_width [expr {[string length $label] + 2}]
  76.   set width [expr {$min_width > 8 ? $min_width : 8}]
  77.   
  78.   button $button -text $label -width $width \
  79.     -command "j:rt text $aboutbox.t; $richtext; j:rt:done"
  80.   frame $border
  81.   raise $button
  82.   pack $button -in $border -padx 2 -pady 2
  83.   pack [j:filler $parent] $border -in $parent -side right
  84. }
  85.   
  86.   
  87.  
  88. ######################################################################
  89. # j:about_jay - talk about myself
  90. ######################################################################
  91.  
  92. proc j:about_jay {} {
  93.   return {
  94.     j:rt:hl "Jay Sekora"
  95.     j:rt:cr
  96.     j:rt:tt "js@bu.edu"
  97.     j:rt:cr
  98.     j:rt:rm "URL "
  99.     j:rt:tt "http://shore.net/~js/"
  100.     j:rt:par
  101.     j:rt:rm "I'm a Unix systems administrator at Boston University."
  102.     j:rt:par
  103.     j:rt:rm "I was a linguistics major in college.  "
  104.     j:rt:rm "I like spicy food, Celtic folk music, bad puns, New England "
  105.     j:rt:rm "contra dancing, and "
  106.     j:rt:it "Winnie the Pooh."
  107.   }
  108. }
  109.  
  110. ######################################################################
  111. # j:about_tktcl - describe tk and tcl
  112. ######################################################################
  113.  
  114. proc j:about_tktcl {} {
  115.   return {
  116.     j:rt:hl "Tk and Tcl"
  117.     j:rt:par
  118.     j:rt:rm "This application is written in "
  119.     j:rt:tt "wish"
  120.     j:rt:rm ", a scripting shell for X Windows applications based on the "
  121.     j:rt:rm "Tk toolkit, which in turn is based on the Tcl"
  122.     j:rt:rm " language and scripting library, all amazingly useful tools "
  123.     j:rt:rm "by John Ousterhout of Sun Microsystems."
  124.     j:rt:par
  125.     j:rt:rm "The Internet newsgroup "
  126.     j:rt:tt "comp.lang.tcl"
  127.     j:rt:rm " is devoted to Tcl and related tools, and a Tk/Tcl FAQ "
  128.     j:rt:rm "(`Frequently Asked Questions') is periodically posted.  "
  129.     j:rt:rm "The latest distributions are available on the FTP site "
  130.     j:rt:tt "ftp.cs.berkeley.edu"
  131.     j:rt:rm ", and "
  132.     j:rt:tt "ftp.aud.alcatel.com"
  133.     j:rt:rm " has the FAQ and user\255contributed scripts."
  134.   }
  135. }
  136.  
  137.  
  138.